#ifndef _TABLE_MAPPING_H__
#define _TABLE_MAPPING_H__

#include "proc/connection.h"
#include "config.h"
#include "tableschema.h"
#include <string>
#include <map>
using namespace std;

class TableMapping
{
public:
	TableMapping(Oracle::Connection &connection, map<string, string> &parameters);
	~TableMapping();
	
	int init(const char *configFile);
	
	map<string, string> &getMap();
	const Index *getTargetKey() const;
	const Table &getTargetTable() const;
	const Table &getSourceTable() const;
	
	const string &getMethod();
	
	
private:
	int internal();
	int external();
	int special();
	
	int formatCol(string &col, const vector<Column> &columns);
	int upperCol(string &col, const vector<Column> &columns);
	
private:	
	Config config;
	
	TableSchema *sourceSchema;
	TableSchema *targetSchema;	
	map<string, string> mapping;
	
	map<string, string> &parameters;
	
	Oracle::Connection &connection;
};

#endif
